<!-- 用户管理 -->
<div class="wrapper">
	<!-- second-nav -->
	<!-- <div ng-include="'main/admin/nav.html'"></div> -->
	<!-- wrapper-content -->
	<section class="wrapper-content">
		<div class="container-fluid">
			<h2 class="content-title"><span class="margin-right-10">用户管理</span><small>用户列表</small></h2>
		</div>
		<!-- btn-row -->
		<div class="btn-row clearfix">
			<div class="col-md-6">
				<button class="btn btn-primary" ng-click="openAdd()" class="btn btn-primary btn-lg">添加</button>
			</div>
		</div>
		<!-- ng-table-row -->
		<div class="row">
			<div class="container-fluid">
				<div class="col-md-12">
					<table class="table table-bordered" ng-table="userList">
						<tr ng-repeat="item in $data">
							<td title="'名称'" sortable="'name'">{{item.name}}</td>
							<td title="'登录名'">{{item.userName}}</td>
							<td title="'手机号'">{{item.mobile}}</td>
							<td title="'邮件'">{{item.email}}</td>
							<td title="'操作'" class="text-center">
								<div class="btn-group">
	                                <button ng-click="openEdit(item);" class="btn btn-sm btn-success" title="编辑"><i class="fa fa-pencil"></i></button>
	                                <button ng-click="openDel(item);" class="btn btn-sm btn-warning" title="删除"><i class="fa fa-times"></i></button>
	                                <button ng-click="openUpdatePwd(item);" class="btn btn-sm btn-info" title="重置密码"><i class="fa fa-random"></i></button>
	                            </div>
							</td>
						</tr>
					</table>
					<div class="row">
						<div class="col-md-6">
							<div class="pull-left btn btn-default">总数：<span class="badge">{{ totalRow }}</span></div>	
						</div>
						<div class="col-md-6">
							<!-- 分页 -->
							<nav>
								<ul class="pagination ng-table-pagination fr">
									<li>
										<a ng-click="previous()"><span>上一页</span></a>
									</li>
									<li ng-repeat="page in pageList" ng-class="{active: isActivePage(page)}" >
										<a ng-click="getUserList(page)">{{ page }}</a>
									</li>
									<li>
										<a ng-click="next()"><span>下一页</span></a>
									</li>
								</ul>
							</nav>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 新增 addUserModel -->
		<div class="modal" id="addUserModel" tabindex="-1" role="dialog" aria-labelledby="addUserModel" aria-hidden="true">
			<div class="modal-dialog modal-lg" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">新建用户</h3>
					</div>
					<div class="modal-body">
						<div class="form-horizontal">
							<!-- 用户名 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="inputName">显示名</label>
								</div>
								<div class="col-md-6">
									<div><input id="inputName" name="inputName" class="form-control" placeholder="显示名" type="text" ng-model="newUserItem.name" ng-change="watchName('new')"></div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newUserItem.warn.name"></div>
							</div>
							<!-- 登录名 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="inputloginname">登陆名</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<input id="inputloginname" name="inputloginname" placeholder="登陆名" class="form-control" type="text" ng-model="newUserItem.userName" ng-change="watchUserName('new')">
										<span class="input-group-addon">@{{user.suffix}}</span>
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newUserItem.warn.userName"></div>
							</div>
							<!-- 密码 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="inputpassword">密码</label>
								</div>
								<div class="col-md-6 ng-scope">
						            <div class="input-group">
						                <input type="text" class="form-control" name="inputpassword" id="input_password" required="" placeholder="密码" ng-model="newUserItem.pwd" ng-change="watchPwd('new')">
						                <span class="input-group-btn">
						                    <button class="btn btn-success" ng-click="randomPassword('new')" type="button">随机密码</button>
						                </span>
						            </div>
						        </div>
						        <div class="col-md-2 text-danger" ng-bind="newUserItem.warn.pwd"></div>
							</div>
							<!-- 邮箱 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="inputemail">邮箱</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
										<input id="inputemail" name="inputemail" class="form-control" type="text" enable-validate="true" ng-model="newUserItem.email" ng-change="watchEmail('new')">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newUserItem.warn.email"></div>
							</div>
							<!-- 手机号码 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="inputMobile">手机号码</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
										<input id="inputMobile" name="inputMobile" class="form-control" type="text" ng-model="newUserItem.mobile" ng-change="watchMobile('new')">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newUserItem.warn.mobile"></div>
							</div>
							<!-- 性别 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="">性别</label>
								</div>
								<div class="col-md-6">
									<select class="form-control" ng-model="newUserItem.sex" ng-options="item.name for item in sex">
										<option value="">-- 请选择 --</option>
									</select>
								</div>
							</div>
							<!-- 订阅通知 -->
							<!-- <div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="id_inputName">订阅通知</label>
								</div>
								<div class="col-md-6">
									<div class="form-control-static">	
										<label style="margin-right:5px;" class="facheckbox">
											<input name="" type="checkbox"><i class="fa fa-lg" aria-hidden="true"></i>
											园长信箱
										</label>
										<label style="margin-right:5px;" class="facheckbox">
											<input name="" type="checkbox"><i class="fa fa-lg" aria-hidden="true"></i>
											预约参观
										</label>
										<label style="margin-right:5px;" class="facheckbox">
											<input name="" type="checkbox"><i class="fa fa-lg" aria-hidden="true"></i>
											入园报名
										</label>
									</div>
								</div>
							</div> -->
							<!-- 分配角色 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="">分配角色</label>
								</div>
								<div class="col-md-6">
									<ui-select multiple ng-model="newUserItem.userroleIds" theme="bootstrap" close-on-select="false" title="选择角色">
										<ui-select-match placeholder="请选择">
											<span ng-bind="$item.name"></span>
										</ui-select-match>
										<ui-select-choices repeat="data in roleList | filter:$select.search">
										    <span ng-bind="data.name"></span>
										</ui-select-choices>
									</ui-select>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="addUser()">提交</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 修改 editUserModel -->
		<div class="modal" id="editUserModel" tabindex="-1" role="dialog">
			<div class="modal-dialog modal-lg" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">编辑用户</h3>
					</div>
					<div class="modal-body">
						<div class="form-horizontal">
							<!-- 用户名 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="inputName">显示名</label>
								</div>
								<div class="col-md-6">
									<div><input id="inputName" name="inputName" class="form-control" placeholder="显示名" type="text" ng-model="modUserItem.name"  ng-change="watchName('edit')"></div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modUserItem.warn.name"></div>
							</div>
							<!-- 登录名 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="inputloginname">登陆名</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<input id="inputloginname" name="inputloginname" placeholder="登陆名" class="form-control" type="text" ng-model="modUserItem.userName" ng-change="watchUserName('edit')">
										<span class="input-group-addon">@{{user.suffix}}</span>
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modUserItem.warn.userName"></div>
							</div>
							<!-- 邮箱 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="inputemail">邮箱</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
										<input id="inputemail" name="inputemail" class="form-control" type="text" enable-validate="true" ng-model="modUserItem.email" ng-change="watchEmail('edit')">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modUserItem.warn.email"></div>
							</div>
							<!-- 手机号码 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="inputMobile">手机号码</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
										<input id="inputMobile" name="inputMobile" class="form-control" type="text" ng-model="modUserItem.mobile" ng-change="watchMobile('edit')">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modUserItem.warn.mobile"></div>
							</div>
							<!-- 性别 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="">性别</label>
								</div>
								<div class="col-md-6">
									<select class="form-control" ng-model="modUserItem.sex" ng-options="item.name for item in sex">
										<option value="">-- 请选择 --</option>
									</select>
								</div>
							</div>
							<!-- 订阅通知 -->
							<!-- <div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="id_inputName">订阅通知</label>
								</div>
								<div class="col-md-6">
									<div class="form-control-static">	
										<label style="margin-right:5px;" class="facheckbox">
											<input name="" type="checkbox"><i class="fa  fa-lg" aria-hidden="true"></i>
											园长信箱
										</label>
										<label style="margin-right:5px;" class="facheckbox">
											<input name="" type="checkbox"><i class="fa  fa-lg" aria-hidden="true"></i>
											预约参观
										</label>
										<label style="margin-right:5px;" class="facheckbox">
											<input name="" type="checkbox"><i class="fa  fa-lg" aria-hidden="true"></i>
											入园报名
										</label>
									</div>
								</div>
							</div> -->
							<!-- 分配角色 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="id_inputName">分配角色</label>
								</div>
								<div class="col-md-6">
									<ui-select multiple ng-model="modUserItem.userroleIds" theme="bootstrap" close-on-select="false" title="选择角色">
										<ui-select-match placeholder="请选择">
											<span ng-bind="$item.name"></span>
										</ui-select-match>
										<ui-select-choices repeat="data in roleList | filter:$select.search">
										    <span ng-bind="data.name"></span>
										</ui-select-choices>
									</ui-select>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="editUser()">提交</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 删除 delUserModel -->
		<div class="modal" id="delUserModel" tabindex="-1" role="dialog">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">删除用户</h3>
					</div>
					<div class="modal-body">
						<p class="text-danger text-center">删除将造成相关数据丢失，请确认是否继续删除。</p>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="delUser()">确认</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 重置密码 updatePwdModel -->
		<div class="modal" id="updatePwdModel" tabindex="-1" role="dialog">
			<div class="modal-dialog modal-lg" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">重置密码</h3>
					</div>
					<div class="modal-body">
						<div class="form-horizontal">
							<!-- 密码 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="inputpassword">密码</label>
								</div>
								<div class="col-md-6 ng-scope">
									<span class="alert alert-info">需重置密码的用户：{{modUserItem.name}} &lt;{{modUserItem.userName}}&gt;</span>
						            <div class="input-group">
						                <input type="text" class="form-control" name="inputpassword" id="inputpassword" required="" placeholder="密码" ng-model="newPwd" ng-change="watchPwd('edit')">
						                <span class="input-group-btn">
						                    <button class="btn btn-success" ng-click="randomPassword('update')" type="button">随机密码</button>
						                </span>
						            </div>
						        </div>
						        <div class="col-md-2 text-danger" ng-bind="modUserItem.warn.pwd"></div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="updatePwd()">确认</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 提示 infoModel -->
		<info-modal msg="msg" visible="visible"></info-modal>
	</section>
</div>